import { createApp } from "vue";
import App from "./App.vue";
// 引入router文件
import router from "./router";

// 引入 Vant 组件
import { Toast, Dialog, Notify, ImagePreview } from "vant";
import "vant/lib/index.css"; // 引入 Vant 样式
import "vant/es/notify/style";
import "vant/es/dialog/style";
import "vant/es/toast/style";

import "@/styles/index.scss";

// normalize.css
import "normalize.css/normalize.css";

// svg icon
import "virtual:svg-icons-register";

import { store } from "@/store/index";

// 进度条配置
import NProgress from "nprogress";
import "nprogress/nprogress.css";
NProgress.configure({
  showSpinner: false
});

import "@/utils/rem";

// 状态管理器
import { createPinia } from "pinia";
// 持久化
import pinia from "@/store/pinia";

import BaiduMap from "vue-baidu-map-3x";

// 创建 Vue 应用实例并使用router
const app = createApp(App).use(router);

// 注册 Vant 组件
app.use(Toast);
app.use(Dialog);
app.use(Notify);
app.use(ImagePreview);

app.use(createPinia());
app.use(pinia);

app.use(BaiduMap, {
  ak: "LQ5dVB2bnbFjfF9jkf2wxly7jUkhu71B" // 替换为你的百度地图 API 密钥
});

app.mount("#app");

const userStore = store.useUserStore();
userStore.initializeUserData();
